﻿using System.Collections.Specialized;

namespace CodingExercises._11_20;

public class CountHalvings
{
    // 计算数值减半直到小于1的次数
    public static int Method(double value)
    {
        if (value < 0)
        {
            throw new ArgumentException("Value cannot be smaller than 0");
        }

        int counter = 0;
        do
        {
            value /= 2;
            ++counter;
        } while (value >= 1);

        return counter;
    }
}